package ar.edu.itba.pod.Legajo47342.communication.handlers;

import ar.edu.itba.pod.Legajo47342.Node;
import ar.edu.itba.pod.simul.communication.Message;
import ar.edu.itba.pod.simul.communication.NodeAgentLoad;
import ar.edu.itba.pod.simul.communication.payload.NodeAgentLoadPayload;

public class NodeAgentLoadHandler implements Handler {

	private Node node;
	
	public NodeAgentLoadHandler(Node node) {
		super();
		this.node = node;
	}

	@Override
	public void handle(Message message) {
		
		NodeAgentLoadPayload loadPayLoad = (NodeAgentLoadPayload) message.getPayload();
		NodeAgentLoad load = new NodeAgentLoad(message.getNodeId(), loadPayLoad.getLoad());
		node.getLoads().put(message.getNodeId(), load);

	}

}
